"use strict"

/**
 * 中国政府采购网 ”所有类型“ 爬虫
 *  
 */


var Base = require("./base");
var ccgpgov_spider = new Base();
ccgpgov_spider.name = "中国政府采购网";

//local
ccgpgov_spider.getPageUrl = function (pg) {
    var url = "http://www.ccgp.gov.cn/cggg/dfgg/index.htm";
    if (pg != 1) {
        url = "http://www.ccgp.gov.cn/cggg/dfgg/index_" + (pg - 1) + ".htm";
    }
    return url;
}

ccgpgov_spider.getItems = function ($) {
    var items = [];
    $(".ulst li a").each(function (index, ele) {
        var e = $(ele);
        var item = {};
        item.title = e.attr("title");
        item.url = "http://www.ccgp.gov.cn/cggg/dfgg" + e.attr("href").substring(1);
        item.source = ccgpgov_spider.name;
        items.push(item);
    });
    return items;
}

exports = module.exports = ccgpgov_spider;